<template>
  <section>
    <ul>
      <li v-for="(item, index) in evenNumbers" :key="index">{{item}}</li>
    </ul>
    或者
    <ul>
      <li v-for="(item, index) in even(numbers)" :key="index">{{item}}</li>
    </ul>
  </section>
</template>

<script>
export default {
  name: "FilterAndOrder",
  data() {
    return {
      numbers: [1, 2, 3, 4, 5]
    };
  },
  computed: {
    evenNumbers() {
      return this.numbers.filter(item => item % 2 === 0);
    }
  },
  methods: {
    even() {
      return this.numbers.filter(item => item % 2 === 0);
    }
  }
};
</script>